package fr.univ.surveyonline.question;

import java.io.IOException;

import org.junit.rules.ExpectedException;

import org.junit.*;

import static org.junit.Assert.*;

public class TestQuestion {

	// TESTED OBJECT
	private Question question;
	
	@Rule
	public ExpectedException thrown = ExpectedException.none();
	
	@Before
	public void setUp() {
		this.question = new Question();
	}
	
	@Test
	public void testSetText_01_1() {
		thrown.expect(IllegalArgumentException.class);
		this.question.setText(null);
	}
	
	@Test
	public void testSetText_01_2() {
		thrown.expect(IllegalArgumentException.class);
		this.question.setText("");
	}
	
	@Test
	public void testSetText_02_1() {
		String question = "une question";
		this.question.setText(question);
		assertEquals(question, this.question.getText());
	}
	
	@Test
	public void testSetText_02_2() {
		String question = "deux questions";
		this.question.setText(question);
		assertEquals(question, this.question.getText());
	}
	
	@Test
	public void testSetText_02_3() {
		String question = "trois questions";
		this.question.setText(question);
		assertEquals(question, this.question.getText());
	}
	
	@Test
	public void testRender_01() throws IOException {
		thrown.expect(IllegalArgumentException.class);
		this.question.render(null);
	}
}
